package main

import (
	"fmt"
	"github.com/aliyun/aliyun-oss-go-sdk/oss"
	"log"
	"math"
)

func main() {
	ts := math.Round((100 / 100) * (10.0 / 100) * 10)
	//log.Println("是：v%",ts)
	fmt.Printf("Result =: %.1f", ts)

	//putData()
}

func getObj() {
	endpoint := "https://oss-cn-beijing.aliyuncs.com"
	accessKeyId := "LTAI5tMUxgQeSgPrs11eUSd6"
	accessKeySecret := "GqwzTiDZslpLJFjkWfvZFl14vPL1nZ"
	client, err := oss.New(endpoint, accessKeyId, accessKeySecret)
	if err != nil {
		log.Println("出错了", err)
		return
	}
	bucket, err := client.Bucket("jinmao-dhy-prod-private")
	if err != nil {
		log.Println("出错了", err)
		return
	}
	filepath := "/Users/appleli/work/golang/workspace/test/da41111.xlsx"
	objectKey := "test/da4.xlsx"
	err = bucket.GetObjectToFile(objectKey, filepath)
	if err != nil {
		log.Println("出错了", err)
		return
	}
	log.Println("-------执行完毕--------")
}

func putData() {
	endpoint := "https://oss-cn-beijing.aliyuncs.com"
	accessKeyId := "LTAI5tMUxgQeSgPrs11eUSd6"
	accessKeySecret := "GqwzTiDZslpLJFjkWfvZFl14vPL1nZ"
	client, err := oss.New(endpoint, accessKeyId, accessKeySecret)
	if err != nil {
		log.Println("client出错了", err)
	}
	bucket, err := client.Bucket("jinmao-dhy-prod-private")
	if err != nil {
		log.Println("bucket出错了", err)
	}
	filepath := "/Users/appleli/work/golang/workspace/test/da4.xlsx"
	objectKey := "test/da4.xlsx"
	err = bucket.PutObjectFromFile(objectKey, filepath)
	if err != nil {
		log.Println("上传文件出错了", err)
	}
	log.Println("-------执行完毕--------")
}
